package com.zyd.databindingdemo;

import androidx.appcompat.app.AppCompatActivity;
import androidx.databinding.DataBindingUtil;
import androidx.databinding.ObservableField;

import android.os.Bundle;

import com.zyd.databindingdemo.databinding.ActivityTwoWayMainBinding;

/**
 * 双向绑定
 */
public class TwoWayMainActivity extends AppCompatActivity {
    ActivityTwoWayMainBinding activityTwoWayMainBinding;
    ObservableField<String> content;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        activityTwoWayMainBinding = DataBindingUtil.setContentView(this, R.layout.activity_two_way_main);

        content = new ObservableField<>("content");
        activityTwoWayMainBinding.setContent(content);


    }
}